package com.atguigu.juc.day03.collection;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

public class Demo03Map {

    public static void main(String[] args) {
        Map<String, String> map =
                // new HashMap<>();
                // new Hashtable<>();
                new ConcurrentHashMap<>();

        for (int i = 0; i < 10; i++) {
            new Thread(()->{

                for (int j = 0; j < 10; j++) {
                    String key = UUID.randomUUID().toString().replace("-", "").substring(0, 5).toUpperCase();
                    String value = UUID.randomUUID().toString().replace("-", "").substring(0, 5).toUpperCase();
                    map.put(key, value);
                    System.out.println("map = " + map);
                }

            }, "thread-" + i).start();
        }
    }

}
